package com.gxa.entity;

//@Data
//@AllArgsConstructor
//@NoArgsConstructor
public class R<T> {
    private Integer code; //返回的状态码
    private String msg; //返回提示信息
    private T data; //带回数据：map  list  entity ..........

    public R() {
    }

    public R(Integer code, String msg) {
        this.code = code;
        this.msg = msg;
    }

    public R(Integer code, String msg, T data) {
        this.code = code;
        this.msg = msg;
        this.data = data;
    }

    public Integer getCode() {
        return code;
    }

    public void setCode(Integer code) {
        this.code = code;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public T getData() {
        return data;
    }

    public void setData(T data) {
        this.data = data;
    }

    public static R Error (){
        R r=new R();
        r.setCode(500);
        r.setMsg("系统开小差！");
        return r;
    }
    public static R Error (Integer code,String msg){
        R r=new R();
        r.setCode(code);
        r.setMsg(msg);
        return r;
    }
    public static R success (){
        R r=new R();
        r.setCode(200);
        r.setMsg("成功！");
        return r;
    }
    public static R success (Integer code,String msg){
        R r=new R();
        r.setCode(code);
        r.setMsg(msg);
        return r;
    }
    public static R success (Integer code,Object data,String msg){
        R r=new R();
        r.setCode(code);
        r.setMsg(msg);
        r.setData(data);
        return r;
    }

}
